package com.hanlin.backend.common.util;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.ToString;

/**
 * 通用返回结果集
 *
 * @author:hl.yuan
 * @date：2020-12-22
 */
@Data
@ToString
@ApiModel("通用返回结果集")
public class ResultCommon<T> {

    @ApiModelProperty("返回信息")
    private String message = "";

    @ApiModelProperty("返回code码，0为正确，其他为错误")
    private String code;

    @ApiModelProperty("返回数据")
    private T data;

    public ResultCommon() {
        this.code = "0";
    }

    public ResultCommon(T data) {
        this.code = "0";
        this.data = data;
    }

    public ResultCommon(String code, String message) {
        this.code = code;
        this.message = message;
    }

    public ResultCommon(String code, String message, T data) {
        this.code = code;
        this.message = message;
        this.data = data;
    }

}
